package com.ruyuan.eshop.common.message;


import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.NoArgsConstructor;


/**
 <p>
 可追溯的消息
 </p>
 * 儒猿课堂: http://www.ruyuan2020.com
 * @Author zhonghuashishan
 * @Remark 有问题直接联系客服VX: ruyuan-1111 ，源码-笔记-技术交流群
 * @Version 1.0
 **/
@Data
@NoArgsConstructor
public class TraceableMessage {
    /**
     * trace id
     */
    private String traceId;
    /**
     * 消息体对应的类
     */
    private Class<?> clazz;
    /**
     * 消息体
     */
    private String messageContent;

    public TraceableMessage(String traceId, Class<?> clazz, Object messageContent) {
        this.traceId = traceId;
        this.clazz = clazz;
        this.messageContent = JSONObject.toJSONString(messageContent);
    }
}
